home *** CD-ROM | disk | FTP | other *** search
- // windows.cnh
-
- // -------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------
- func Gui_Component NewWindow(i32x _iWidth,i32x _iHeight);
- func Gui_Component NewArea(i32x _iWidth,i32x _iHeight);
-
- func void Window_AddColumnTitle(Gui_Component _poComponent,Gui_Component _poRef);
- func void Window_AddRowTitle(Gui_Component _poComponent,Gui_Component _poRef, i32x _iBackColor);
- func void Window_DeleteRowTitle();
- //
- // Window
- // -----------------------------------------------------------------------------------------------------------------
- message WindowMount(Gui_Component _poObject);
- message WindowSize(i32x _iWidth,i32x _iHeight);
- message WindowUpdate();
- message WindowAddColumnTitle(Gui_Component _poComponent,Gui_Component _poRef);
- message WindowAddRowTitle(Gui_Component _poComponent,Gui_Component _poRef, i32x _iBackColor);
- message AreaContentUpdate(i32x _iWidth,i32x _iHeight);
- message HScroll(f32x _fValue);
- message VScroll(f32x _fValue);
- message Resize(Gui_Component _poObject);
- //message Update(Gui_Component _gcSender);
- message TitleUpdatePosX();
- message TitleUpdatePosY();
- message SetBackColor(i32x _iColor); // forms
- // -------------------------------------------------------------
- // -------------------------------------------------------------
-
- // Window Data class
- class Gui_dtWindow
- {
- var i32x iTopMargin;
- var i32x iLeftMargin;
- var i32x iWidth;
- var i32x iHeight;
- var i32x iAreaWidth;
- var i32x iAreaHeight;
- var Gui_Component gcArea;
- var Gui_Component gcBack;
- var Gui_Component gcBorder;
- var Gui_Component gcSliderH; // Horizontal slider
- var Gui_Component gcSliderV; // Vertical slider
- var Gui_Component gcTitleColumn;
- var Gui_Component gcTitleRow;
- };
- class Gui_dtArea
- {
- var i32x iWidth;
- var i32x iHeight;
- var Gui_Component gcChild;
- };
- class Gui_dtTitle
- {
- var i32x bMouseDown;
- var Gui_Component gcTitle;
- var Gui_Component gcRef;
- var Gui_Component gcBackground;
- var i32x iBackColor;
- };
- class Gui_dtTitleList
- {
- var Gui_Component gcBackground;
- var Gui_Component gcLineSeparator;
- };
-
- // Forward declaration
- func void Window_Mount(Gui_Component _poObject);
- func void Area_Mount(Gui_Component _poObject);
- func void Window_Size(i32x _iWidth,i32x _iHeight);
- func void Area_Size(i32x _iWidth,i32x _iHeight);
- func void Window_AreaUpdate(i32x _iWidth,i32x _iHeight);
- func void Area_Update();
- func void Window_SliderChange(Gui_Component _pslider,f32x _fValue);
- func void Area_HScroll(f32x _fValue);
- func void Area_VScroll(f32x _fValue);
- func void Window_MoveX();
- func void Window_MoveY();
-
- func void TitleList_UpdatePosX();
- func void TitleList_UpdatePosY();
- func i32x TitleColumn_OnMouseUp(i32x _iX,i32x _iY,i32x _iButton);
- func i32x TitleColumn_OnMouseDown(i32x _iX,i32x _iY,i32x _iButton);
- func i32x TitleColumn_OnMouseLeave(i32x _iX,i32x _iY);
- func i32x TitleRow_OnGainFocus();
- func i32x TitleRow_OnLoseFocus();
-
- // Window
- interface Gui_iWindow
- {
- // System message
- // ...
- // User message
- Window_Mount WindowMount;
- Window_Size WindowSize;
- Window_AreaUpdate AreaContentUpdate;
- Window_AddColumnTitle WindowAddColumnTitle;
- Window_AddRowTitle WindowAddRowTitle;
- Window_MoveX TitleUpdatePosX;
- Window_MoveY TitleUpdatePosY;
- // Slider message response
- Window_SliderChange SldChange;
- }
- interface Gui_iArea
- {
- // System message
- // ...
- // User message
- Area_Mount WindowMount;
- Area_Size WindowSize;
- Area_Update WindowUpdate;
- // Scroll message
- Area_HScroll HScroll;
- Area_VScroll VScroll;
- }
- interface Gui_iTitleList
- {
- TitleList_UpdatePosX TitleUpdatePosX;
- TitleList_UpdatePosY TitleUpdatePosY;
- }
- interface Gui_iTitleColumn
- {
- TitleColumn_OnMouseLeave MouseLeave;
- TitleColumn_OnMouseDown MouseDown;
- TitleColumn_OnMouseUp MouseUp;
- }
-
- interface Gui_iTitleRow
- {
- TitleRow_OnGainFocus GainFocus;
- TitleRow_OnLoseFocus LoseFocus;
- }
-
- func i32x TitleColumn_OnMouseDown(i32x _iX,i32x _iY,i32x _iButton)
- {
- var Gui_Component pthis,ptitle;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- if(_iButton == e_Gui_Mouse_Left_Button)
- pdtTitle.bMouseDown = true;
- }
- func i32x TitleColumn_OnMouseUp(i32x _iX,i32x _iY,i32x _iButton)
- {
- var Gui_Component pthis,ptitle;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- if((_iButton == e_Gui_Mouse_Left_Button)&&(pdtTitle.bMouseDown))
- {
- pdtTitle.bMouseDown = false;
- // Send mouse click to ref component
- pdtTitle.gcRef<<Click(pdtTitle.gcTitle);
- }
- }
-
- func i32x TitleColumn_OnMouseLeave(i32x _iX,i32x _iY)
- {
- var Gui_Component pthis,ptitle;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- pdtTitle.bMouseDown = false;
- }
-
- func i32x TitleRow_OnGainFocus()
- {
- var Gui_Component pthis, ptitle, pform;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- SetColor(pdtTitle.gcBackground, cTableSelectColor);
-
- pform = GetParent(pdtTitle.gcRef);
- pform<<SetBackColor(cTableSelectColor);
-
- return 1;
- }
- func i32x TitleRow_OnLoseFocus()
- {
- var Gui_Component pthis, ptitle, pform;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- SetColor(pdtTitle.gcBackground, pdtTitle.iBackColor);
-
- pform = GetParent(pdtTitle.gcRef);
- pform<<SetBackColor(pdtTitle.iBackColor);
- }
-
- func i32x TitleRow_OnMouseLeave(i32x _iX,i32x _iY)
- {
- //println("onmouseleave");
- /*
- var Gui_Component pthis,ptitle;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- // Retrieve data pointer
- pdtTitle = GetData(pthis);
-
- pdtTitle.bMouseDown = false;
- */
- }
-
-
-
-
- func Gui_Component NewWindow(i32x _iWidth,i32x _iHeight)
- {
- var Gui_Component pwindow, pborder, pWindowBack, pWindowBorder, pColumnTitleBack, pLineSeparator;
- var Gui_dtWindow pdtWindow;
- var Gui_dtTitleList pdtTitleList;
-
- // Create column object
- pwindow = NewObject(Gui_iWindow);
- pdtWindow = new Gui_dtWindow;
- SetData(pwindow,pdtWindow);
- SetComponentNumber(pwindow,4);
-
- // Create Area
- pdtWindow.gcArea = NewArea(_iWidth,_iHeight);
- Transparent(pdtWindow.gcArea);
-
- // create window background
- pWindowBack = NewBoxFilled(smBlueFrame, _iWidth, _iHeight);
- pWindowBack<<Disable();
- MountComponent(pwindow, pWindowBack);
- pdtWindow.gcBack = pWindowBack;
-
- // create window border
- pWindowBorder = NewBox(smWhiteBorder, _iWidth, _iHeight);
- pWindowBorder<<Disable();
- MountComponent(pwindow, pWindowBorder);
- pdtWindow.gcBorder = pWindowBorder;
-
- // create sliders
- pdtWindow.gcSliderV = NewSliderCompositeV(smSlider_V,_iHeight,smUpButton,smDownButton,smWhite);
- pdtWindow.gcSliderH = NewSliderCompositeH(smSlider_H,_iWidth,smLeftButton,smRightButton,smWhite);
-
- // create title for columns
- pdtWindow.gcTitleColumn = NewObject(Gui_iTitleList);
- pdtTitleList = new Gui_dtTitleList;
- SetData(pdtWindow.gcTitleColumn, pdtTitleList);
- // create column title back
- pColumnTitleBack = NewBoxFilled(smWhiteFrame, 10, 10);
- pColumnTitleBack<<BoxSetColor(cTableColumnTitleColor);
- pColumnTitleBack<<Hide(); // hide until we have titles to display
- pColumnTitleBack<<Disable();
- pdtTitleList.gcBackground = pColumnTitleBack;
- MountComponent(pdtWindow.gcTitleColumn, pColumnTitleBack);
- pdtTitleList.gcLineSeparator = 0;
- // create title row line separator
- pLineSeparator = NewBitmap(smWhite, 0);
- SetShadingMode(GetSprite(pLineSeparator), DLC_GouraudMode_ModulateDiffuse, DLC_GouraudMode_ModulateDiffuse);
- SetBlendingMode(GetSprite(pLineSeparator), DLC_Blend_AlphaBlend);
- SetAlign(pLineSeparator, e_GUI_HAlign_Zoom, e_GUI_VAlign_Bottom);
- SetScale(pLineSeparator, iTableLineWidth);
- SetColor(pLineSeparator, cTableLineColor);
- pLineSeparator<<Hide(); // hide until we have titles to display
- pLineSeparator<<Disable();
- pdtTitleList.gcLineSeparator = pLineSeparator;
- MountComponent(pdtWindow.gcTitleColumn, pLineSeparator);
-
- // create titles for row
- pdtWindow.gcTitleRow = NewObject(Gui_iTitleList);
- pdtTitleList = new Gui_dtTitleList;
- SetData(pdtWindow.gcTitleRow, pdtTitleList);
- // create title row line separator
- pLineSeparator = NewBitmap(smWhite, 0);
- SetShadingMode(GetSprite(pLineSeparator), DLC_GouraudMode_ModulateDiffuse, DLC_GouraudMode_ModulateDiffuse);
- SetBlendingMode(GetSprite(pLineSeparator), DLC_Blend_AlphaBlend);
- SetAlign(pLineSeparator, e_GUI_HAlign_Right, e_GUI_VAlign_Zoom);
- SetScale(pLineSeparator, iTableLineWidth);
- SetColor(pLineSeparator, cTableLineColor);
- pLineSeparator<<Hide(); // hide until we have titles to display
- pLineSeparator<<Disable();
- pdtTitleList.gcLineSeparator = pLineSeparator;
- MountComponent(pdtWindow.gcTitleRow, pLineSeparator);
-
- // mount titles
- MountComponent(pwindow, pdtWindow.gcTitleColumn);
- MountComponent(pwindow, pdtWindow.gcTitleRow);
-
- //clip titles
- Clip(pdtWindow.gcTitleColumn);
- Clip(pdtWindow.gcTitleRow);
- // pdtWindow.gcTitleColumn<<Disable();
- // pdtWindow.gcTitleRow<<Disable();
-
- // Fill data
- pdtWindow.iWidth = _iWidth;
- pdtWindow.iHeight = _iHeight;
- pdtWindow.iTopMargin = 0;
- pdtWindow.iLeftMargin = 0;
-
- // Mount Component into window
- MountComponent(pwindow,pdtWindow.gcArea);
- MountComponent(pwindow,pdtWindow.gcSliderH);
- MountComponent(pwindow,pdtWindow.gcSliderV);
-
- // Stretch window to area
- StretchTo(pwindow,_iWidth,_iHeight);
- Clip(pwindow);
- Transparent(pwindow);
-
- // Move slider
- MoveTo(pdtWindow.gcSliderV,_iWidth - SizeX(pdtWindow.gcSliderV),0);
- MoveTo(pdtWindow.gcSliderH,0,_iHeight - SizeY(pdtWindow.gcSliderH));
-
- // Hide slider
- pdtWindow.gcSliderH<<Hide();
- pdtWindow.gcSliderV<<Hide();
-
- return pwindow;
- }
-
- func void Window_AddColumnTitle(Gui_Component _poComponent, Gui_Component _poRef)
- {
- var Gui_Component pwindow,ptitle;
- var Gui_dtWindow pdtWindow;
- var Gui_dtTitle pdtTitle;
- var Gui_dtTitleList pdtTitleList;
- var i32x w,h,iPosX;
- var i32x iAreaWidth,iAreaHeight;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- ptitle = NewObject(Gui_iTitleColumn);
- pdtTitle = new Gui_dtTitle;
- SetData(ptitle, pdtTitle);
- Clip(ptitle);
-
- //Reference component into title
- pdtTitle.gcTitle = _poComponent;
- pdtTitle.gcRef = _poRef;
- // Mount component into title
- MountComponent(ptitle,_poComponent);
- //MoveTo(_poComponent,RelPosX(_poComponent),0);
-
- // Get component size
- w = SizeX(_poComponent);
- h = SizeY(_poComponent);
- h = h + iListBoxFieldPadding*2; // add padding
-
- // Mount title object into list title
- MountComponent(pdtWindow.gcTitleColumn, ptitle);
-
- // Move title to correct pos
- iPosX = AbsPosX(pdtTitle.gcRef) - AbsPosX(pdtWindow.gcTitleColumn);
- MoveTo(ptitle,iPosX, 0);
- StretchTo(ptitle,w,h);
-
- // Update area pos
- if(h>pdtWindow.iTopMargin)
- {
- pdtWindow.iAreaHeight = pdtWindow.iAreaHeight - (h-pdtWindow.iTopMargin);
- pdtWindow.iTopMargin=h;
- }
- pdtWindow.gcArea<<WindowSize(pdtWindow.iAreaWidth,pdtWindow.iAreaHeight);
- MoveTo(pdtWindow.gcArea,pdtWindow.iLeftMargin,pdtWindow.iTopMargin);
-
- // Update title list size and pos
- if(h<SizeY(pdtWindow.gcTitleColumn))
- h = SizeY(pdtWindow.gcTitleColumn);
-
- pdtTitleList = GetData(pdtWindow.gcTitleColumn);
-
- //StretchTo(pdtTitleList.gcBackground, pdtWindow.iAreaWidth + pdtWindow.iLeftMargin, h);
- StretchTo(pdtWindow.gcTitleColumn, pdtWindow.iWidth - pdtWindow.iLeftMargin, h);
- // StretchTo(pdtTitleList.gcBackground, pdtWindow.iWidth - pdtWindow.iLeftMargin, h);
- MoveTo(pdtWindow.gcTitleColumn, pdtWindow.iLeftMargin, 0);
- pdtTitleList.gcBackground<<Show(); // show background
-
- // Move Vertical slider to manage top margin
- MoveTo(pdtWindow.gcSliderV,RelPosX(pdtWindow.gcSliderV),pdtWindow.iTopMargin);
- // Update its size
- pdtWindow.gcSliderV<<SldSize(pdtWindow.iAreaHeight);
-
- // show line separator
- pdtTitleList = GetData(pdtWindow.gcTitleColumn);
- pdtTitleList.gcLineSeparator<<Show();
- }
-
- func void Window_AddRowTitle(Gui_Component _poComponent,Gui_Component _poRef, i32x _iBackColor)
- {
- var Gui_Component pwindow,ptitle;
- var Gui_dtWindow pdtWindow;
- var Gui_dtTitle pdtTitle;
- var Gui_dtTitleList pdtTitleList;
-
- var i32x w,h,iPosY;
- var i32x iAreaWidth,iAreaHeight;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- ptitle = NewObject(Gui_iTitleRow);
- pdtTitle = new Gui_dtTitle;
- SetData(ptitle, pdtTitle);
-
- // init background
- pdtTitle.gcBackground = NewBitmap(smWhite, 0);
- SetShadingMode(GetSprite(pdtTitle.gcBackground), DLC_GouraudMode_ModulateDiffuse, DLC_GouraudMode_ModulateDiffuse);
- SetBlendingMode(GetSprite(pdtTitle.gcBackground), DLC_Blend_AlphaBlend);
- SetAlign(pdtTitle.gcBackground, e_GUI_HAlign_Zoom, e_GUI_VAlign_Zoom);
- pdtTitle.gcBackground<<Disable();
- Clip(pdtTitle.gcBackground);
- MountComponent(ptitle, pdtTitle.gcBackground);
-
- //Reference component into title
- pdtTitle.gcTitle = _poComponent;
- pdtTitle.gcRef = _poRef;
- _poComponent<<Disable();
- // Mount component into title
- MountComponent(ptitle,_poComponent);
-
- // Get component size
- w = SizeX(_poComponent);
- h = SizeY(_poComponent);
-
- // Mount title object into list title
- MountComponent(pdtWindow.gcTitleRow,ptitle);
-
- // Move title to correct pos
- iPosY = AbsPosY(pdtTitle.gcRef) - AbsPosY(pdtWindow.gcTitleColumn);
- MoveTo(ptitle,0,iPosY);
- StretchTo(ptitle,w,h);
-
- // update background size and color
- StretchTo(pdtTitle.gcBackground, w, h);
- pdtTitle.iBackColor = _iBackColor;
- SetColor(pdtTitle.gcBackground, pdtTitle.iBackColor);
-
- // Update area pos
- if(w>pdtWindow.iLeftMargin)
- {
- pdtWindow.iAreaWidth = pdtWindow.iAreaWidth - (w-pdtWindow.iLeftMargin);
- pdtWindow.iLeftMargin=w;
- }
- pdtWindow.gcArea<<WindowSize(pdtWindow.iAreaWidth,pdtWindow.iAreaHeight);
- MoveTo(pdtWindow.gcArea,pdtWindow.iLeftMargin,pdtWindow.iTopMargin);
-
-
- // print("TitleSize:"+itoa(x)+":"+itoa(y)+":"+itoa(w)+":"+itoa(h)+"\n");
- // Update title list size and pos
- if(w<SizeX(pdtWindow.gcTitleRow))
- {
- w = SizeX(pdtWindow.gcTitleRow);
- }
- MoveTo(pdtWindow.gcTitleRow,0,pdtWindow.iTopMargin);
- // Always max size
- StretchTo(pdtWindow.gcTitleRow,w,pdtWindow.iAreaHeight);
-
- // Move Vertical slider to manage top margin
- MoveTo(pdtWindow.gcSliderH,pdtWindow.iLeftMargin,RelPosY(pdtWindow.gcSliderH));
- // Update its size
- pdtWindow.gcSliderH<<SldSize(pdtWindow.iAreaWidth);
-
- // show line separator
- pdtTitleList = GetData(pdtWindow.gcTitleRow);
- pdtTitleList.gcLineSeparator<<Show();
- }
-
-
- func void TitleList_UpdatePosX()
- {
- var Gui_Component pthis,ptitle;
- var i32x iNumComponents,i;
- var i32x iPosX;
- var Gui_dtTitleList pdtTitleList;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
-
- pdtTitleList = GetData(pthis);
-
- iNumComponents = GetComponentNumber(pthis);
- i=0;
- while(i<iNumComponents)
- {
- ptitle=GetComponent(pthis,i);
- if((ptitle)&&(ptitle!=pdtTitleList.gcBackground)&&(ptitle!=pdtTitleList.gcLineSeparator))
- {
- pdtTitle = GetData(ptitle);
- // Move title to correct pos
- iPosX = AbsPosX(pdtTitle.gcRef) - AbsPosX(pthis);
- MoveTo(ptitle,iPosX,0);
- }
- i=i+1;
- }
- }
-
- func void TitleList_UpdatePosY()
- {
- var Gui_Component pthis,ptitle;
- var i32x iNumComponents,i,iPosY;
- var Gui_dtTitleList pdtTitleList;
- var Gui_dtTitle pdtTitle;
-
- // Retrieve title list pointer
- pthis = GetThis();
- pdtTitleList = GetData(pthis);
-
- iNumComponents = GetComponentNumber(pthis);
- i=0;
- while(i<iNumComponents)
- {
- ptitle=GetComponent(pthis,i);
- if((ptitle)&&(ptitle!=pdtTitleList.gcBackground)&&(ptitle!=pdtTitleList.gcLineSeparator))
- {
- pdtTitle = GetData(ptitle);
- // Move title to correct pos
- iPosY = AbsPosY(pdtTitle.gcRef) - AbsPosY(pthis);
- MoveTo(ptitle,0,iPosY);
- // Move component
- //Move(ptitle,0,_iValue);
- }
- i=i+1;
- }
- }
-
- func Gui_Component NewArea(i32x _iWidth,i32x _iHeight)
- {
- var Gui_Component parea;
- var Gui_dtArea pdtArea;
-
- // Create column object
- parea = NewObject(Gui_iArea);
- pdtArea = new Gui_dtArea;
- SetData(parea,pdtArea);
- SetComponentNumber(parea,1);
-
- // Fill data
- pdtArea.iWidth = _iWidth;
- pdtArea.iHeight = _iHeight;
-
- // Stretch area to wanted size
- StretchTo(parea,_iWidth,_iHeight);
- Clip(parea);
- Transparent(parea);
-
- return parea;
- }
-
- // Mount an object into area
- func void Area_Mount(Gui_Component _poObject)
- {
- var Gui_Component parea;
- var Gui_dtArea pdtArea;
-
- // Retrieve area pointer
- parea = GetThis();
-
- // Retrieve data pointer
- pdtArea = GetData(parea);
-
- // Mount object into area
- MountComponent(parea,_poObject);
- pdtArea.gcChild = _poObject;
-
- // Update Window
- Area_Update();
- }
-
- // Mount an object into window
- func void Window_Mount(Gui_Component _poObject)
- {
- var Gui_Component pwindow,parea;
- var Gui_dtWindow pdtWindow;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- // Tell area to mount component
- pdtWindow.gcArea<<WindowMount(_poObject);
- }
-
- func void Window_Size(i32x _iWidth,i32x _iHeight)
- {
- var Gui_Component pwindow,parea;
- var Gui_dtWindow pdtWindow;
- var i32x iAreaWidth,iAreaHeight;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- // Update data
- pdtWindow.iWidth = _iWidth;
- pdtWindow.iHeight = _iHeight;
- pdtWindow.iAreaWidth = pdtWindow.iWidth-pdtWindow.iLeftMargin;
- pdtWindow.iAreaHeight = pdtWindow.iWidth-pdtWindow.iTopMargin;
-
- // Update Area
- pdtWindow.gcArea<<WindowSize(pdtWindow.iAreaWidth,pdtWindow.iAreaHeight);
-
- // Stretch Window
- StretchTo(pwindow,_iWidth,_iHeight);
- }
- func void Area_Size(i32x _iWidth,i32x _iHeight)
- {
- var Gui_Component parea;
- var Gui_dtArea pdtArea;
-
- // Retrieve area pointer
- parea = GetThis();
-
- // Retrieve data pointer
- pdtArea = GetData(parea);
-
- // Update data
- pdtArea.iWidth = _iWidth;
- pdtArea.iHeight = _iHeight;
-
- // Stretch Area
- StretchTo(parea,_iWidth,_iHeight);
- }
- func void Window_MoveX()
- {
- var Gui_Component pwindow;
- var Gui_dtWindow pdtWindow;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- pdtWindow.gcTitleColumn<<TitleUpdatePosX();
- }
- func void Window_MoveY()
- {
- var Gui_Component pwindow;
- var Gui_dtWindow pdtWindow;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- pdtWindow.gcTitleRow<<TitleUpdatePosY();
- }
-
- func void Window_AreaUpdate(i32x _iWidth,i32x _iHeight)
- {
- var boolx bHS,bVS;
- var i32x iWidth,iHeight;
- var i32x iBackWidth, iBackHeight;
- var Gui_Component pwindow;
- var Gui_dtWindow pdtWindow;
- var Gui_Component ptitle;
- var Gui_dtTitle pdtTitle;
- var Gui_dtTitleList pdtTitleList;
- var i32x i,iNumRowTitle;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- // Check slider needs
- //Horizontal
- if(pdtWindow.iWidth-pdtWindow.iLeftMargin<_iWidth)
- {
- pdtWindow.gcSliderH<<Show();
- iHeight = pdtWindow.iHeight - SizeY(pdtWindow.gcSliderH) - pdtWindow.iTopMargin;
- iBackHeight = pdtWindow.iHeight - SizeY(pdtWindow.gcSliderH) / 2;
- bHS = true;
- }
- else
- {
- pdtWindow.gcSliderH<<Hide();
- iHeight = pdtWindow.iHeight - pdtWindow.iTopMargin;
- iBackHeight = pdtWindow.iHeight;
- bHS = false;
- }
- // Vertical
- if(iHeight<_iHeight)
- {
- pdtWindow.gcSliderV<<Show();
- iWidth = pdtWindow.iWidth - SizeX(pdtWindow.gcSliderV) - pdtWindow.iLeftMargin;
- iBackWidth = pdtWindow.iWidth - SizeX(pdtWindow.gcSliderV) / 2;
- if(!bHS)
- {
- // Recheck horizontal slider need
- if(iWidth<_iWidth)
- {
- pdtWindow.gcSliderH<<Show();
- iHeight = pdtWindow.iHeight - SizeY(pdtWindow.gcSliderH) - pdtWindow.iTopMargin;
- iBackHeight = pdtWindow.iHeight - SizeY(pdtWindow.gcSliderH) / 2;
- bHS = true;
- }
- }
- bVS = true;
- }
- else
- {
- pdtWindow.gcSliderV<<Hide();
- iWidth = pdtWindow.iWidth - pdtWindow.iLeftMargin;
- iBackWidth = pdtWindow.iWidth;
- bVS = false;
- }
- // Update Area size
- pdtWindow.iAreaWidth = iWidth;
- pdtWindow.iAreaHeight = iHeight;
- pdtWindow.gcArea<<WindowSize(iWidth,iHeight);
- // update background size
- pdtWindow.gcBack<<BoxResize(iBackWidth, iBackHeight);
-
- pdtWindow.gcBorder<<BoxResize(iBackWidth, iBackHeight);
-
- // update title row
- StretchTo(pdtWindow.gcTitleRow, SizeX(pdtWindow.gcTitleRow), iHeight);
- MoveTo(pdtWindow.gcTitleRow, 0, pdtWindow.iTopMargin);
- // line separator
- pdtTitleList = GetData(pdtWindow.gcTitleRow);
- StretchTo(pdtTitleList.gcLineSeparator, SizeX(pdtWindow.gcTitleRow), iHeight+pdtWindow.iTopMargin);
- MoveTo(pdtTitleList.gcLineSeparator, 0, 0-pdtWindow.iTopMargin);
-
- // update title column
- StretchTo(pdtWindow.gcTitleColumn, iBackWidth - pdtWindow.iLeftMargin, SizeY(pdtWindow.gcTitleColumn));
- // update title column back
- pdtTitleList = GetData(pdtWindow.gcTitleColumn);
- pdtTitleList.gcBackground<<BoxResize(iBackWidth, SizeY(pdtWindow.gcTitleColumn));
- // StretchTo(pdtTitleList.gcBackground, iBackWidth, SizeY(pdtWindow.gcTitleColumn));
- MoveTo(pdtTitleList.gcBackground, 0-pdtWindow.iLeftMargin, 0);
- // line separator
- StretchTo(pdtTitleList.gcLineSeparator, iWidth+pdtWindow.iLeftMargin, SizeY(pdtWindow.gcTitleColumn));
- MoveTo(pdtTitleList.gcLineSeparator, 0-pdtWindow.iLeftMargin, 0);
-
- // Update title pos
- pdtWindow.gcTitleColumn<<TitleUpdatePosX();
- pdtWindow.gcTitleRow<<TitleUpdatePosY();
-
- // Update slider size
- if(bHS)
- {
- pdtWindow.gcSliderV<<SldSize(iHeight);
- }
- if(bVS)
- {
- pdtWindow.gcSliderH<<SldSize(iWidth);
- }
-
- // Check hidden row title
- // Warning Hades check Background of title row !
- iNumRowTitle = GetComponentNumber(pdtWindow.gcTitleRow);
- i=0;
-
-
-
- pdtTitleList = GetData(pdtWindow.gcTitleRow);
-
- while(i<iNumRowTitle)
- {
- ptitle = GetComponent(pdtWindow.gcTitleRow,i);
-
- if((ptitle)&&(ptitle != pdtTitleList.gcLineSeparator))
- {
- pdtTitle = GetData(ptitle);
- if(IsHidden(GetParent(pdtTitle.gcRef)))
- {
- ptitle<<Hide();
- }
- else
- {
- ptitle<<Show();
- // update rowtitle back color
- if (IsFocused(GetParent(pdtTitle.gcRef))) SetColor(pdtTitle.gcBackground, cTableSelectColor);
- else SetColor(pdtTitle.gcBackground, pdtTitle.iBackColor);
- }
- }
- i=i+1;
- }
- }
-
- func void Area_Update()
- {
- var i32x iWidth,iHeight;
- var Gui_Component parea,pwindow;
- var Gui_dtArea pdtArea;
-
- // Retrieve area pointer
- parea = GetThis();
-
- // Retrieve data pointer
- pdtArea = GetData(parea);
- if(pdtArea.gcChild)
- {
- iWidth = SizeX(pdtArea.gcChild);
- iHeight = SizeY(pdtArea.gcChild);
- }
- else
- {
- iWidth = 0;
- iHeight = 0;
- }
-
- // Retrieve parent window
- pwindow = GetParent(parea);
-
- // Update windows inner size
- pwindow<<AreaContentUpdate(iWidth,iHeight);
- }
-
- func void Window_SliderChange(Gui_Component _pslider,f32x _fValue)
- {
- var Gui_Component pwindow;
- var Gui_dtWindow pdtWindow;
-
- // Retrieve area pointer
- pwindow = GetThis();
-
- // Retrieve data pointer
- pdtWindow = GetData(pwindow);
-
- // Which slider ?
- if(_pslider == pdtWindow.gcSliderH)
- {
- pdtWindow.gcArea<<HScroll(_fValue);
- }
- if(_pslider == pdtWindow.gcSliderV)
- {
- pdtWindow.gcArea<<VScroll(_fValue);
- }
- }
-
- func void Area_HScroll(f32x _fValue)
- {
- var i32x iDeltaWidth,iPosX;
- var f32x fOffset;
- var Gui_Component parea,pwindow;
- var Gui_dtArea pdtArea;
-
- // Retrieve area pointer
- parea = GetThis();
-
- // Retrieve data pointer
- pdtArea = GetData(parea);
-
- // Move child
- iDeltaWidth = SizeX(pdtArea.gcChild) - pdtArea.iWidth;
- if(iDeltaWidth>0)
- {
- fOffset = -iDeltaWidth;
- fOffset = fOffset*_fValue;
- iPosX = fOffset+0.5;
- MoveTo(pdtArea.gcChild,iPosX,RelPosY(pdtArea.gcChild));
-
- // Retrieve parent window
- pwindow = GetParent(parea);
- pwindow<<TitleUpdatePosX();
- }
- }
- func void Area_VScroll(f32x _fValue)
- {
- var i32x iDeltaHeight,iPosY,iDeltaY;
- var f32x fOffset;
- var Gui_Component parea,pwindow;
- var Gui_dtArea pdtArea;
-
- // Retrieve area pointer
- parea = GetThis();
-
- // Retrieve data pointer
- pdtArea = GetData(parea);
-
- // Move child
- iDeltaHeight = SizeY(pdtArea.gcChild) - pdtArea.iHeight;
- if(iDeltaHeight>0)
- {
- fOffset = -iDeltaHeight;
- fOffset = fOffset*_fValue;
- iPosY = fOffset+0.5;
- MoveTo(pdtArea.gcChild,RelPosX(pdtArea.gcChild),iPosY);
- // Retrieve parent window
- pwindow = GetParent(parea);
-
- pwindow<<TitleUpdatePosY();
- }
- }
-
-